package com.aabte.hystrixlearn.hystrix.command;

import com.netflix.hystrix.HystrixCommand;
import com.netflix.hystrix.HystrixCommandGroupKey;
import com.netflix.hystrix.HystrixCommandKey;
import com.netflix.hystrix.HystrixCommandProperties;

/**
 * @author Daniel
 */
public class FailureCommand extends HystrixCommand<String> {

    public FailureCommand() {
        super(Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey("FailureCommandGroup"))
                .andCommandKey(HystrixCommandKey.Factory.asKey("FailureCommand"))
                .andCommandPropertiesDefaults(HystrixCommandProperties.Setter()
                        // 设置降级并发度为10
                        .withFallbackIsolationSemaphoreMaxConcurrentRequests(10)));
    }

    @Override
    protected String run() throws Exception {
        return null;
    }

    @Override
    protected String getFallback() {
        return "降级逻辑";
    }
}
